Write a custom CUDA kernel to optimize `EIS-2`.

Formula: f(x) = (x * log(1 + exp(x))) / sqrt(beta + gamma * x^2)

Problem Analysis:
1. Computationally Intensive & Memory Bound: The operation involves a chain of `exp`, `log`, `sqrt`, and arithmetic ops.
2. Operator Chaining: A PyTorch implementation creates multiple intermediate tensors.
3. Numerical Stability: `exp(x)` can overflow for large positive x.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused Stable Math:
   - For each element `x`:
     `sp = (x > 20) ? x : log1pf(__expf(x))` (Stable Softplus for numerator)
     `numerator = x * sp`
     `denom_inv = rsqrtf(beta + gamma * x * x)` (fast inverse square root)
     `result = numerator * denom_inv`
   - All steps are fused in registers.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn
import torch.nn.functional as F

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

BETA_VAL = 1.0
GAMMA_VAL = 1.0

class EIS2(nn.Module):
    """
    EIS-2 Activation.
    EIS- A FAMILY OF ACTIVATION FUNCTIONS COMBINING EXPONENTIAL, ISRU, AND SOFTPLUS
    https://arxiv.org/pdf/2009.13501

    Formula: f(x) = (x * log(1 + exp(x))) / sqrt(beta + gamma * x^2)
    """
    def __init__(self, beta=1.0, gamma=1.0):
        super(EIS2, self).__init__()
        self.beta = beta
        self.gamma = gamma

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        numerator = x * F.softplus(x)
        denominator = torch.sqrt(self.beta + self.gamma * x.pow(2))
        return numerator / (denominator + 1e-7)

class Model(nn.Module):
    def __init__(self, beta=1.0, gamma=1.0):
        super(Model, self).__init__()
        self.act = EIS2(beta, gamma)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 5.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [BETA_VAL, GAMMA_VAL]